<?php
/**
 * ============================================================================
 * Copyright (c) 2015-2018 贵州大师兄信息技术有限公司 All rights reserved.
 * siteַ: http://www.dsxcms.com
 * ============================================================================
 * @author:     David Song<songdewei@163.com>
 * @version:    v1.0.0
 * ---------------------------------------------
 * Date: 2018/10/26
 * Time: 10:30 AM
 */

namespace App\WeChat\Response;


class QueryOrderResponse
{
    private $values = [
        'return_code'=>null,
        'return_msg'=>null,
        'appid'=>null,
        'mch_id'=>null,
        'nonce_str'=>null,
        'sign'=>null,
        'result_code'=>null,
        'openid'=>null,
        'is_subscribe'=>null,
        'trade_type'=>null,
        'bank_type'=>null,
        'total_fee'=>null,
        'fee_type'=>null,
        'transaction_id'=>null,
        'out_trade_no'=>null,
        'attach'=>null,
        'time_end'=>null,
        'trade_state'=>null,
        'cash_fee'=>null,
        'trade_state_desc'=>null,
        'err_code'=>null,
        'err_code_des'=>null,
    ];

    public function __construct($data = [])
    {
        if (!empty($data)) {
            foreach ($data as $key=>$value){
                $this->values[$key] = $value;
            }
        }
    }

    public function returnCode()
    {
        return $this->values['return_code'];
    }

    public function returnMsg()
    {
        return $this->values['return_msg'];
    }

    public function appid()
    {
        return $this->values['appid'];
    }

    public function mchId()
    {
        return $this->values['mch_id'];
    }

    public function nonceStr()
    {
        return $this->values['nonce_str'];
    }

    public function sign()
    {
        return $this->values['sign'];
    }

    public function resultCode()
    {
        return $this->values['result_code'];
    }

    public function openid()
    {
        return $this->values['openid'];
    }

    public function isSubscribe()
    {
        return $this->values['is_subscribe'];
    }

    public function tradeType()
    {
        return $this->values['trade_type'];
    }

    public function bankType()
    {
        return $this->values['bank_type'];
    }

    public function totalFee()
    {
        return $this->values['total_fee'];
    }

    public function feeType()
    {
        return $this->values['fee_type'];
    }

    public function transactionId()
    {
        return $this->values['transaction_id'];
    }

    public function outTradeNo()
    {
        return $this->values['out_trade_no'];
    }

    public function attach()
    {
        return $this->values['attach'];
    }

    public function timeEnd()
    {
        return $this->values['time_end'];
    }

    public function tradeState()
    {
        return $this->values['trade_state'];
    }

    public function cashFee()
    {
        return $this->values['cash_fee'];
    }

    public function tradeStateDesc()
    {
        return $this->values['trade_state_desc'];
    }

    public function errCode()
    {
        return $this->values['err_code'];
    }

    public function errCodeDes()
    {
        return $this->values['err_code_des'];
    }

    public function response()
    {
        return $this->values;
    }

    public function tradeSuccess()
    {
        return $this->tradeState() == 'SUCCESS';
    }
}
